import { Wrapper } from './FileBlob.styled'

export const Demo = () => {
  const onCreateNew = async () => {
    const blob = new Blob(['123']);
    console.log(blob)
    const file = new File(['123'], '123.txt');
    console.log(file)

    // console.log(await blob.arrayBuffer())
    // console.log(await file.arrayBuffer())

    // const fr = new FileReader()
    // fr.onload = (e:any) =>{
    //   console.log(fr.result)
    //   console.log(e.target.result)
    // }
    // fr.readAsArrayBuffer(file)

    const dv = new DataView(await blob.arrayBuffer())
    console.log(dv)
    console.log(dv.getUint8(1))
    dv.setUint8(1, 65);
  }
  return (
    <Wrapper>
      <h1>new Blob/File</h1>
      <button onClick={onCreateNew}>new blob & file</button>
    </Wrapper>
  )
}
